package com.zte.market.service.otherService.otherImpl;

import com.zte.market.mapper.otherMapper.CkWarehouseMapper;
import com.zte.market.pojo.otherPojo.CkWarehouse;
import com.zte.market.pojo.otherPojo.Warehouse;
import com.zte.market.service.otherService.CkWarehouseService;
import com.zte.market.service.otherService.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 出库
 * @Auther: 许月
 * @Date: 2022/10/06/19:29
 */
@Service
public class CkWarehouseServiceImpl implements CkWarehouseService {
    @Autowired
    private CkWarehouseMapper ckWarehouseMapper;  //出库的 mapper 接口



    @Autowired
    private WarehouseService warehouseService;   //仓库的 service 对象


    /**
     * 通过仓库id查询 出库仓库信息
     */
    @Override
    public CkWarehouse getByWarehouseId(Integer warehouseId) {
        CkWarehouse ckWarehouse = null;
        if(warehouseId != null && !"".equals(warehouseId)) {
            ckWarehouse = ckWarehouseMapper.queryByWarehouseId(warehouseId);
            //向出库信息中补充仓库信息
            Warehouse warehouse = warehouseService.getByWarehouseId(warehouseId);
            ckWarehouse.setWarehouse(warehouse);
        }
        return ckWarehouse;
    }
}
